<?php
namespace Common\Model;

class TurnBikeModel extends CommonModel{
	private $form_data;
	protected $_validate = array(
		array('float_type','require','请选择浮动方式'),
		array('float_cash','check_float','请输入浮动金额',0,'callback'),
		array('profile','require','请输入出让描述'),
		array('profile','1,300','出让描述最多300个字',0,'length'),
		array('pics','check_pic','请上传车辆照片',0,'callback'),
		array('mobile','check_contact','三种联系方式至少填写一个',0,'callback'),
		array('weixin','check_contact','三种联系方式至少填写一个',0,'callback'),
		array('qq','check_contact','三种联系方式至少填写一个',0,'callback'),
	);
	public function _initialize(){
		$this->form_data = I('post.info');
	}
	protected function check_float(){
		if($this->form_data['float_type'] != '1' && $this->form_data['float_cash'] == '')return false;
		return true;
	}
	protected function check_pic(){
		if(is_array($this->form_data['pics']) && count($this->form_data['pics']) > 0)return true;
		return false;
	}
	protected function check_contact(){
		if($this->form_data['mobile'] == '' && $this->form_data['weixin'] == '' && $this->form_data['qq'] == '')return false;
		return true;
	}
}